package com.gma.userprofile.info.social

import com.gma.userprofile.util.{HBaseUtil, SparkUtil}
import org.apache.spark.sql.DataFrame

object UserProfilePhone {
  def main(args: Array[String]): Unit = {

    //获取分区参数
    val ds = args.head
    //1、创建spark sql环境
    val spark = SparkUtil.getSparkSession

    //导入隐式转换
    import spark.implicits._

    //2、从hive中获取表
    val userinfo: DataFrame = spark
      .table("dim.dim_pub_user_info_d_f") //获取用户维度表
      .where($"ds" === ds) //获取对应分区数据

    //3、提取性别标签
    val phoneTag: DataFrame = userinfo
      .select($"id", $"phone")

    //4、将结果保存到hbase
    HBaseUtil.tagToHBase(phoneTag, "phone")
  }
}
